import request from "@/request";
import type { responseType } from "./interface";

const prefix = "/dailyReportEntity";

/**
 * 查询-通过用户acc获取日报
 */
export function DailyReportByAcc(acc: string): Promise<responseType> {
  return request.post(`${prefix}/getProjectByAcc/${acc}`);
}
export interface InsertDailyReportParams {
  id?: number;
  acc?: string;
  date?: any;
  report?: string;
  hour?: number;
  selfEval?: number;
  leaderEval?: number;
  conclude?: string;
  createBy?: string;
  createTime?: string;
  updateBy?: string;
  updateTime?: string;
  undock?: number;
  state?: number;
  remark?: string;
  startTime?: string;
  endTime?: string;
}

/**
 * 新增保存日报
 */
export function saveDailyReport(
  params: InsertDailyReportParams
): Promise<responseType> {
  return request.post(`${prefix}/insert`, params);
}

/**
 * 修改保存日报
 */
export function updateDailyReport(
  params: InsertDailyReportParams
): Promise<responseType> {
  return request.post(`${prefix}/update`, params);
}

export interface InsertWeekReportParams {
  id: number;
  year: number;
  month: number;
  weekNumber: number;
  acc: string;
  weekScore: number;
  weekContent: string;
  weekEvaluator: string;
  createBy: string;
  createTime: string;
  updateBy: string;
  updateTime: string;
  undock: number;
  state: number;
  remark: string;
}
/**
 * 修改打分
 */
export function updateWeekReport(
  params: InsertWeekReportParams
): Promise<responseType> {
  return request.post(`/weekEntity/update`, params);
}
